<?php /* Smarty version 2.6.18, created on 2016-12-14 09:01:30
         compiled from score/score.diy.tpl.php */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.header.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.left.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
	  <form name="form1" action="" method="get">
        <section class="col-sm-3 connectedSortable" style="padding-right:0px;">
               <div class="box box-solid">
                  <div class="box-header with-border" id="boring">
                       <div class="form-group">
                                <select class="form-control" style="padding:0;" id="semester_id" name="semester_id">
                                      <option value="0">请选择学年学期</option>
									  <?php $_from = $this->_tpl_vars['semester_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                                      <option value="<?php echo $this->_tpl_vars['value']['semester_id']; ?>
" <?php if ($this->_tpl_vars['value']['semester_id'] == $this->_tpl_vars['semester_data']['semester_id']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['value']['semester_name']; ?>
</option>
									  <?php endforeach; endif; unset($_from); ?>	

                                </select>					  
                        </div>
                        <div class="form-group">
                                <select class="form-control grades" style="padding:0;" name="exam_id"  id="exam_name">
                                      <option value="0">-请选择-</option>
										<?php if ($this->_tpl_vars['exam_data'] != ""): ?>
                                      <option value="<?php echo $this->_tpl_vars['exam_data']['exam_id']; ?>
" selected><?php echo $this->_tpl_vars['exam_data']['exam_name']; ?>
</option>
										<?php endif; ?>									  
                                </select>					  
                        </div>
                        <div class="form-group">
                                <select class="form-control classfy" style="padding:0;" onChange="grade_change()" name="grade_id" id="grade_id"> 
                                      <option>请选择年级</option>
									  <?php $_from = $this->_tpl_vars['class_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                                      <option value="<?php echo $this->_tpl_vars['key']; ?>
" <?php if ($this->_tpl_vars['key'] == $this->_tpl_vars['grade_data']['grade_id']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['value']['grade_name']; ?>
</option>
									  <?php endforeach; endif; unset($_from); ?>
                                </select>					  
                        </div>
						<?php $_from = $this->_tpl_vars['class_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                        <div class="form-group all" style="height:100px; overflow-y:scroll; <?php if ($this->_tpl_vars['key'] == $this->_tpl_vars['grade_data']['grade_id']): ?>display:block<?php else: ?>display:none<?php endif; ?>" id="cg_<?php echo $this->_tpl_vars['key']; ?>
" >
                               <label><input type="checkbox" name="allChecked1" id="allChecked" onclick="DoCheck()"> 全选 </label><br/>
							   <?php $_from = $this->_tpl_vars['value']['class']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['v']):
?>
                               <label><input type="checkbox" name="class_ids[]" value="<?php echo $this->_tpl_vars['v']['class_id']; ?>
" <?php if ($this->_tpl_vars['v']['check'] == '1'): ?>checked<?php endif; ?>> <?php echo $this->_tpl_vars['v']['class_name']; ?>
 </label><br/>
							   <?php endforeach; endif; unset($_from); ?>					  
                        </div>
						<?php endforeach; endif; unset($_from); ?>
                    </div>
                </div><!--box box-solid-->
                 <div class="box box-solid">
                      <div class="box-header with-border">
                           <label>分数段</label>
                            <div class="form-group">
                                  <table class="table" id="plus">
                                       <tr>
                                            <td>选择</td>
                                            <td>最高分</td>
                                            <td>最低分</td>
                                       </tr>
									   <?php $_from = $this->_tpl_vars['range']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                                       <tr>
										<td><input type='checkbox' name='chkArr' id='chkArr<?php echo $this->_tpl_vars['key']; ?>
' style='width:20px' /></td>
										<td><input type='text' name='range_max_<?php echo $this->_tpl_vars['key']; ?>
' value="<?php echo $this->_tpl_vars['value']['max']; ?>
" id='nodeper<?php echo $this->_tpl_vars['key']; ?>
' style='width:40px' /></td>
										<td><input type='text' name='range_min_<?php echo $this->_tpl_vars['key']; ?>
' value="<?php echo $this->_tpl_vars['value']['min']; ?>
" id='nodename<?php echo $this->_tpl_vars['key']; ?>
' style='width:40px' /></td>
                                       </tr>									   
									   <?php endforeach; endif; unset($_from); ?>
                                </table>
                                <input type="button" onclick="addNewRow();" value="添加分数段" />
                                <a href="#" onclick="removeRow();"> 删除</a>     				  
                            </div>
                        </div>
                </div><!--box box-solid-->
                 <div class="box box-solid">
                      <div class="box-header with-border">
                           <label class="col-sm-2" style="padding:0">科目</label>
                           <div class="col-sm-9 form-group" style="height:80px; overflow-y:scroll; margin-bottom:30px;">
                                   <label><input type="radio" name="subject_id" value="0"  <?php if ($this->_tpl_vars['subject_id'] == '0'): ?>checked<?php endif; ?>> 总分</label><br/>
									<?php $_from = $this->_tpl_vars['subject_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                                   <label><input type="radio" name="subject_id" value="<?php echo $this->_tpl_vars['value']['subject_id']; ?>
" <?php if ($this->_tpl_vars['value']['subject_id'] == $this->_tpl_vars['subject_id']): ?>checked<?php endif; ?>> <?php echo $this->_tpl_vars['value']['subject_name']; ?>
</label><br/>
									<?php endforeach; endif; unset($_from); ?>
                            </div>
                            <div style="clear:both;">
							<input type="hidden" name="a" value="score.diy">
                            <button type="submit" class="btn btn-primary btn-sm">确定查询</button>
                            </div>
                        </div>
                </div><!--box box-solid-->
        </section>
		</form>
        <section class="col-sm-9 connectedSortable">
         <div class="box box-default box-solid">
                <div class="box-header with-border">
                    <span class="fa fa-list" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">分数段自定义查询列表</p>
                </div>
                <div class="box-body">
                     <h4 class="text-center"><?php echo $this->_tpl_vars['semester_data']['semester_name']; ?>
<?php echo $this->_tpl_vars['exam_data']['exam_name']; ?>
<?php echo $this->_tpl_vars['grade_data']['grade_name']; ?>
<?php echo $this->_tpl_vars['subject_name']; ?>
自定义分数段查询</h4>
                       <table class="table table-bordered"  id="mytable">
                                    <tr>
                                        <td>年级名称</td>
                                        <td>班级名称</td>
										<?php $_from = $this->_tpl_vars['range']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<td><?php echo $this->_tpl_vars['value']['max']; ?>
-<?php echo $this->_tpl_vars['value']['min']; ?>
分</td>
										<?php endforeach; endif; unset($_from); ?>
                                    </tr>
									<?php $_from = $this->_tpl_vars['data_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
                                    <tr>
                                        <td><?php echo $this->_tpl_vars['grade_data']['grade_name']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['value']['class_name']; ?>
</td>
										<?php $_from = $this->_tpl_vars['value']['score']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['v']):
?>
										<td><?php echo $this->_tpl_vars['v']; ?>
</td>
										<?php endforeach; endif; unset($_from); ?>
                                    </tr>
									<?php endforeach; endif; unset($_from); ?>	 	
                        </table>  
				</div><!--box-body -->
                <div class="box-footer">
 
                </div>
           </div><!--box box-default box-solid-->
         </section>   
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.footer.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
 <script>
    function grade_change()
           {
			$(".all").hide();
            var val = $("#grade_id").val();
			$("#cg_"+val).show();
           }
		   	   
 	function DoCheck()
		{
			var ch = document.getElementsByName("class_ids[]");
			if(document.getElementsByName("allChecked")[0].checked == true)
		   {
				for(var i=0;i<ch.length;i++)
				{
				ch[i].checked=true;
				}
			}else{
				for(var i=0;i<ch.length;i++)
				{
				ch[i].checked=false;
				}
			}
		}

		  function addNewRow(){
		   var tabObj=document.getElementById("plus");//获取添加数据的表格
		   var rowsNum = tabObj.rows.length;  //获取当前行数
		   var colsNum=tabObj.rows[rowsNum-1].cells.length;//获取行的列数
		   var myNewRow = tabObj.insertRow(rowsNum);//插入新行
		   var newTdObj1=myNewRow.insertCell(0);
		   newTdObj1.innerHTML="<input type='checkbox' name='chkArr' id='chkArr"+rowsNum+"' style='width:20px' />";
		   var newTdObj2=myNewRow.insertCell(1);
		   newTdObj2.innerHTML="<input type='text' name='range_max_"+rowsNum+"' id='nodeper"+rowsNum+"' style='width:40px' />";
		   var newTdObj3=myNewRow.insertCell(2);
		   newTdObj3.innerHTML="<input type='text' name='range_min_"+rowsNum+"' id='nodename"+rowsNum+"' style='width:40px' />";
		  }
		//窗口表格删除一行
		  function removeRow(){
		   var chkObj=document.getElementsByName("chkArr");
		   var tabObj=document.getElementById("plus");
		   for(var k=0;k<chkObj.length;k++){
			if(chkObj[k].checked){
			 tabObj.deleteRow(k+1);
			 k=-1;
			}
		   }
		  }
</script>
  <script type="text/javascript">
        $(document).ready(function () {
             $("#semester_id").change(function () {		
                 if ($(this).val() == "-1") {
					$("#industr").remove(); return; 
					}
                else {
			var timestamp = new Date().getTime();
			$.ajax({
			url:"index.php?a=exam.listBySemesterJson",
			type:"get",
			data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
			dataType:"json",
			success:function(msg){
                             var industr = "";
                             $.each(msg, function (n, v) {
                                industr += ("<option value=\"" + n + "\">" + v);
                                industr += ("</option>");
                            });
                             $("#exam_name").html(industr);			   			   
			}
			});					
                 }

            });

        });
</script>